From 028e7d32c62c7cd277b23990d29fc71e43f1f66b Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 2 Nov 2022 09:54:39 +0000
Subject: [PATCH] overlays: pisound: Make button pins owned by card

The pisound overlay claims a number of GPIOs using a pinctrl node, but
for some reason hangs this claim on the main gpio node. This obscures
the ownership of the pins (as shown by gpioinfo and in the kernel logs)
and isn't scalable - only one overlay can use the trick at a time.

Change the overlay to make the pin ownership clear and avoid any future
conflicts, removing a bogus claim on pins_spi0 at the same time.

See: https://github.com/raspberrypi/linux/issues/5235

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/pisound-overlay.dts | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

--- a/arch/arm/boot/dts/overlays/pisound-overlay.dts
+++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts
@@ -55,8 +55,6 @@
 			pisound_spi: pisound_spi@0{
 				compatible = "blokaslabs,pisound-spi";
 				reg = <0>;
-				pinctrl-names = "default";
-				pinctrl-0 = <&spi0_pins>;
 				spi-max-frequency = <1000000>;
 			};
 		};
@@ -80,6 +78,7 @@
 			i2s-controller = <&i2s>;
 			status = "okay";
 
+			pinctrl-names = "default";
 			pinctrl-0 = <&pisound_button_pins>;
 
 			osr-gpios =
@@ -100,9 +99,6 @@
 	fragment@6 {
 		target = <&gpio>;
 		__overlay__ {
-			pinctrl-names = "default";
-			pinctrl-0 = <&pisound_button_pins>;
-
 			pisound_button_pins: pisound_button_pins {
 				brcm,pins = <17>;
 				brcm,function = <0>; // Input
